(function() {

this.codium = this.codium || {};
this.codium.panel = this.codium.panel || {};

this.codium.panel.Solution = pasta.webgui.Panel.extend(
{
	init : function() 
	{
		this._super();
		
		this.canvas.style.background = "rgba(0, 0, 0, 0.4)";
		this.canvas.style.zIndex = "1000";
		
		this.pnl = new pasta.webgui.ContainerControl();
		this.pnl.setWidth(400);
		this.pnl.setHeight(240);
		this.pnl.setLeft((this.getWidth() - this.pnl.getWidth()) / 2);
		this.pnl.setTop((this.getHeight() - this.pnl.getHeight()) / 3);
		this.pnl.canvas.style.background = "rgba(255, 255, 255, 0.9)";
		this.pnl.canvas.style.border = "1px solid rgba(255, 255, 255, 1)";
		this.pnl.canvas.style.webkitBoxShadow = "0px 1px 8px #000000";
		this.pnl.canvas.style.mozBoxShadow = "0px 1px 8px #000000";
		this.pnl.canvas.style.boxShadow = "0px 1px 8px #000000";
		this.pnl.canvas.style.mozBorderRadius = "6px";
		this.pnl.canvas.style.webkitBorderRadius = "6px";
		this.pnl.canvas.style.borderRadius = "6px";
		this.addControl(this.pnl);
		
			this.lblTitle = new pasta.webgui.Label();
			this.lblTitle.setCaption(".: Solution");
			this.lblTitle.setWidth(this.pnl.getWidth());
			this.lblTitle.setTop(10);
			this.lblTitle.setLeft(10);
			this.lblTitle.font.setSize(16);
			this.lblTitle.font.setBold(true);
			this.pnl.addControl(this.lblTitle);
			
			this.btnCancel = new pasta.webgui.Button();
			this.btnCancel.setCaption("Cancel");
			this.btnCancel.setWidth(80);
			this.btnCancel.setTop(this.pnl.getHeight() - 40);
			this.btnCancel.setLeft(this.pnl.getWidth() - 85);
			this.btnCancel.getOnClick().setHandler(this, this.btnCancelClick);
			this.pnl.addControl(this.btnCancel);
			
			this.btnOK = new pasta.webgui.Button();
			this.btnOK.setCaption("OK");
			this.btnOK.setWidth(80);
			this.btnOK.setTop(this.btnCancel.getTop());
			this.btnOK.setLeft(this.btnCancel.getLeft() - 85);
			this.btnOK.getOnClick().setHandler(this, this.btnOKClick);
			this.pnl.addControl(this.btnOK);
			
			this.lblMessage = new pasta.webgui.Label();
			this.lblMessage.setLeft(10);
			this.lblMessage.setTop(40);
			this.lblMessage.setWidth(200);
			this.lblMessage.setCaption("Solution :");
			this.lblMessage.font.setBold(true);
			this.pnl.addControl(this.lblMessage);
			
			this.mmoMessage = new pasta.webgui.Memo();
			this.mmoMessage.setLeft(this.lblMessage.getLeft());
			this.mmoMessage.setTop(this.lblMessage.getTop() + 20);
			this.mmoMessage.setWidth(this.pnl.getWidth() - (2 * this.mmoMessage.getLeft()) - 2);
			this.mmoMessage.setHeight(100);
			this.pnl.addControl(this.mmoMessage);
		
		this.setVisible(false);
	},
	
	//--------------------- Service Event ---------------------
	
	//--------------------- Event ---------------------
	
	show : function(title)
	{
		this.initSize();
		
		this._super();
		
		this.lblTitle.setCaption(".: " + title);
		this.lblMessage.setCaption(title + " : ");
		this.mmoMessage.setText("");
	},
	
	initSize : function()
	{
		this.pnl.setLeft((this.getWidth() - this.pnl.getWidth()) / 2);
		this.pnl.setTop((this.getHeight() - this.pnl.getHeight()) / 3);
	},
	
	btnCancelClick : function(sender)
	{
		this.close();
	},
	
	btnOKClick : function(sender)
	{
		if (this._onOK != null)
			this._onOK.callHandler(this, this.mmoMessage.getText());
		
		this.close();
	},
	
	//--------------------- Setter & Getter ---------------------
	
	setWidth : function(data)
	{
		this._super(data);
		this.initSize();
	},
	
	setHeight : function(data)
	{
		this._super(data);
		this.initSize();
	},
	
	getOnOK : function()
	{
		if (this._onOK == null)
			this._onOK = new pasta.util.EventObj();
		
		return this._onOK;
	},
});
	
})();